package com.leoman.spinningmachine.tab1;

import android.content.Context;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.leoman.helper.adapter.BaseRecyclerAdapter;
import com.leoman.helper.util.FrescoUtil;
import com.leoman.spinningmachine.R;
import com.leoman.spinningmachine.bean.NewsListBean;
import com.leoman.spinningmachine.util.DateUtil;

import java.util.List;

/**
 * Created by Administrator on 2018-05-11.
 */

public class TzggAdapter extends BaseRecyclerAdapter<NewsListBean> {
    private Context mContext;
    public TzggAdapter(Context context,int layoutResId, List data) {
        super(layoutResId, data);
        this.mContext = context;
    }

    @Override
    protected void bindTheData(BaseViewHolder holder, NewsListBean bean, int position) {
        TextView title = (TextView)holder.findViewById(R.id.tv_news_title);
        TextView viewNum = (TextView)holder.findViewById(R.id.tv_watch_count);
        TextView time = (TextView)holder.findViewById(R.id.tv_time);
        SimpleDraweeView simpleDraweeView = (SimpleDraweeView)holder.findViewById(R.id.iv_pic);

        FrescoUtil.setImg(mContext,simpleDraweeView,bean.getImage());
        title.setText(""+bean.getTitle());
        viewNum.setText(""+bean.getViewNum());
        time.setText(""+ DateUtil.getyMdStr(bean.getCreateDate()));
    }
}
